<!doctype html>
<?php
error_reporting(E_ALL & ~E_NOTICE);
session_start();
?>
<html>
<head>
<meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>购物车</title>
    <link rel="stylesheet" href="css/common.css" />
    <link rel="stylesheet" href="css/header.css" />
    <link rel="stylesheet" href="css/goodsList.css" />
	<link rel="stylesheet" href="css/mycar.css" />
		<link rel="stylesheet" href="canico.css">
</head>

<body>
 <header>
        <div id="head-top" style="margin-top: 5px;">
            <nav class="clearfix">

	  <div class="location" style="">
       <span>地区 ： </span>
      <i class="cd-location">&nbsp;<input type="text" class="selectBoxPub_r flightto" style="border:none;width:50px;background-color:#e6e3e6; font-size: 12px;"></i>
</div>		        

				  
				  
				  
				   
                <ul class="right clearfix">
                    <li class="menu welcome">
                       <?php
						if(!empty($_SESSION['identity'])){
                       echo "<a href='index.php' class='link-login'>主页</a>";}
						
					else{
							echo "<a href='login.php' class='link-login'>你好，请登录</a>";
						}
						
						?>
                       
                    </li>
                    <li class="spacer">|</li>
                    <li class="menu red"><a href="myorder.html" style="color:#999">加入我们</a></li>
                    <li class="spacer">|</li>
                    <li class="menu red">
                     鲜锋站点&nbsp;v
                    </li>
                    <li class="spacer">|</li>
                    <li class="menu red">企业合作</li>
                    <li class="spacer">|</li>
                    <li class="menu qiye"><a href="service.html">人工客服&nbsp;∨</a></li>
                    <li class="spacer">|</li>

                </ul>
            </nav>
        </div>
        <div class="w clearfix">
            <div id="logo">
                <a href="index.html"><img src="img/logo.png" ></a>
            </div>
            <div id="search">
                <!-- 搜索列表  已隐藏 -->
                <ul class="menu" id="shelper"></ul>
                <div class="form">
                    <input type="text" id="key" value="水果" class="text blurcolor">
                    <i class="fa fa-camera"></i>
                    <button>搜索</button>
                </div>
            </div>
            <div id="settleup" class="dropdown">
                <div class="cw-icon">
                    <i class="fa fa-shopping-cart car"></i>
               <?php    /* <i class="i-count" id="count">0</i>*/?>
                    <a href="collection.php" style="margin-left: 18px;">我的收藏</a>
                </div>
                
            </div>
            <div id="hotwords" class="haveline clearfix">
                <a href="#">香蕉</a>
                <b>|</b>
                <a href="#">苹果</a>
                <b>|</b>
                <a href="#">牛奶</a>
                <b>|</b>
                <a href="#">酸奶</a>
                <b>|</b>
                <a href="#">车厘子</a>
                <b>|</b>
                <a href="#">水果礼盒</a>
                <b>|</b>
                <a href="#">葡萄</a>
                <b>|</b>
                <a href="#">柚子</a>
                <b>|</b>
                <a href="#">橙子</a>
                <b>|</b>
                <a href="#">榴莲</a>

            </div>
        </div>
    </header>

<section>
<div id="nav">
            <div class="w clearfix">
                <div id="categorys" style="height: auto; left: 0px; position: absolute;">
                    <div class="dt">
                        <a href="gwc.php">我的购物车</a>
                    </div>
                    <div class="dd" style="display: none;"></div>
                </div>
                
            </div>
        </div>
		        <div class="w">
            <div class="mb10"></div>
            <div class="cart-filter-bar">
             
                
                </div>
                <div class="w-line">
                    <div class="floater" style="width: 79px;">
                    </div>
                </div>
            </div>
        </div>
		<div class="cart-wrap">
            <div class="w">
                <div id="jd-cart">
                    <div class="cart-thead clearfix">
                        <div class="column t-checkbox">
                            <div class="cart-checkbox">
                                <input type="checkbox" class="jd-checkbox selectAll" checked="checked">
                            </div>
                            全选
                        </div>
                        <div class="column t-goods">商品</div>
                        <div class="column t-blank">商铺</div>
                        <div class="column t-price">单价</div>
                        <div class="column t-quantity">数量</div>
                        <div class="column t-sum">小计</div>
                        <div class="column t-action">操作</div>
                    </div>
                    <div class="cart-list">
                        <div class="cart-item-list" id="cart-item-list-01">
                            <div class="cart-tbody">
                                <div class="shop">
                                    <div class="cart-checkbox">
                                        <input type="checkbox" name="checkShop" checked="checked" class="jd-checkbox">
                                    </div>
                                    <span class="shop-txt">
                                        <a href="#">优惠购</a>

                            </select>                                       
                                    </span>
                                    <div class="extra-r">
                                                                                <span>
                                            <i class="fa fa-exclamation-circle" style="margin-right: 120px;"></i>
                                            （运费在结算页面显示）
                                        </span>
                                    </div>
                                </div>
                        <?php

                       $goods=$_SESSION['goods'];		
                       if(is_array($_SESSION['goods'])){	
	                   foreach ($goods as $value){
                         echo       "<div class='item-list clearfix'>";
                         echo        "<div class='item-single  item-item  item-selected clearfix' id=''>";
                         echo         "<div class='item-form clearfix'>";
                         echo              "<div class='cell p-checkbox clearfix'>";
                         echo                 " <div class='cart-checkbox'>
                                                    <input type='checkbox' name='checkItem' checked='checked' class='jd-checkbox'>
                                                </div>";
                          echo                  "</div>";
                          echo                  "<div class='cell p-goods clearfix'>";
                          echo                      "<div class='goods-item clearfix'>";
                          echo                         "<div class='p-img'>
                                                        <a href='#'><img src='img/".$value['picture']."' alt='' width='80' height='80'></a>
                                                    </div>";
                          echo                         "<div class='item-msg'>";
                          echo                             "<div class='p-name'>
                                                            <a href='#' style='margin-left:60px;'>
                                                                ".$value['goodsname']."</a>
                                                        </div>";
                         /* echo                         " <div class='p-extend'>
                                                            <span>
                                                               <select style='margin-left:60px;'>
                                                          <option value ='volvo'>上门配送</option>
                                                           <option value ='saab'>站点自取</option>
                                                              <option value='opel'>货到付款</option>
                                                                
                                                              </select>
                                                            </span>
                                                        </div>";*/
                              echo                      "</div>";
                              echo                 "</div>";
                              echo              "</div>";
                              echo               "<div class='cell p-props'>";
                              echo               "<div class='props-txt' title='' style='margin-left:20px;'>".$value['market']."</div>";
                              echo               "<div class='props-txt' title='' style='margin-left:20px;'>".$value['storename']."</div>";
                              echo             "</div>";
                              echo             "<div class='cell p-price' style='margin-left:-10px;'>";
						  if($_SESSION['identity']=='企业用户'){
                               echo                  "<p class='plus-switch' >
                                                    <strong >".$value['price']."元/5斤</strong>
                                                </p>";}
						   else{
                               echo                  "<p class='plus-switch' >
                                                    <strong >".$value['price']."元/斤</strong>
                                                </p>";							   
						   }
						 
                               echo             "<div>
                                                 <div class='clr'></div>
                                                 </div>";
                                echo            "</div>";
                                echo            "<div class='cell p-quantity' style='margin-left:-6px;'>";
                                echo                "<div class='quantity-form'>
                                                    <a href=goodscut.php?goodsname=" . $value['goodsname'] . '&price=' . $value['price'] ." class='decrement disabled'>-</a>
                                                    <input type='text' value=" . $value['number'] ." class='itxt'>
                                                    <a href=goodsadd.php?goodsname=" . $value['goodsname'] . '&price=' . $value['price'] ." class='increment'>+</a>
                                                </div>";
                                 echo           " <div class='quantity-txt'>有货</div>";
                                 echo           "</div>";
                                 echo		"<div class='cell p-sum' style='margin-left:1px;'>
                                                <strong>".$value['goodsprice']."元</strong>
                                            </div>";
                                 echo           "<div class='cell p-ops'>
                                                <a href=goodsdel.php?goodsname=" . $value['goodsname'] . '&price=' . $value['price'] ." class='cart-remove'>删除</a>
                                                <a href=collection.php?goodsname=" . $value['goodsname'] . '&price=' . $value['price'] ." class='cart-follow'>移到到收藏</a>
                                            </div>";
								  /*echo		"<div class='cell p-sum'>
                                                <strong>".$value['price']."</strong>
                                            </div>";*/
                                  echo      "</div>";
                                  echo      "<div class='item-extra mb10'></div>";
                                  echo  "</div>";
                               echo "</div>";  }}
							?>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- 去结算 -->
                <div id="cart-floatbar" class="clearfix" style="width: 1000px; height: 52px;">
                    <div class="options-box clearfix">
                        <div class="select-all">
                            <div class="cart-checkbox">
                                <input type="checkbox" class="jd-checkbox selectAll" checked="checked">
                                全选
                            </div>
                        </div>
                        <div class="operation">
                                    
                           
							<a href="cleargwc.php">清空购物车</a>
                          	

                           
                        </div>
                        <div class="clr"></div>
                        <div class="toolbar-right clearfix">
                            <div class="comm-right clearfix">
                                <div class="btn-area">
                       <?php      echo 
	"<a href=paytest.php?goodsname=" . $value['goodsname'] . '&price=' . $value['price'] .'&storename=' . $value['storename'] .'&price=' . $value['picture'] ." class='submit-btn'>去结算</a>";      
	
	/*<a href="javascript: void(0);" class="submit-btn">去结算</a>*/
	?>
                                </div>
                                <div class="price-sum clearfix">
                                    <div class="clearfix" style="padding-top:8px">
                                        <span class="txt" style="margin-top: -2px;">总价：</span>
                                        <span class="sumPrice">
                                            <em><?php
												echo $_SESSION['totalprice'];
												?>元</em>
                                        </span>
                                        <i class="fa fa-lightbulb-o  fa-lg"></i>

                                    </div>
                                </div>

                                <div class="clr"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

 </div>
</body>
</html>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=eFaNjhaFcBEWaqwqs3N5ziq4PKUClOiY"></script>
 <script>
			var isLocate = false; //判断是否定位

			var flightto = document.querySelector(".flightto");
			//获取地理位置定位
			function locateMe() {
				var geolocation = new BMap.Geolocation();
				geolocation.getCurrentPosition(function(r) {
					if(this.getStatus() == BMAP_STATUS_SUCCESS) {
						isLocate = true;
						var url = "http://api.map.baidu.com/geocoder/v2/" +
							"?callback=renderReverse&location=" + r.point.lat + "," + r.point.lng + "&output=json&pois=1&ak=eFaNjhaFcBEWaqwqs3N5ziq4PKUClOiY";
						var JSONP = document.createElement("script");
						JSONP.src = url;
						document.body.appendChild(JSONP);
					} else {
						alert('failed' + this.getStatus());
					}
				}, {
					enableHighAccuracy: true
				})
			}
			locateMe();

			function renderReverse(r) {
				flightto.value = r.result.addressComponent.city;
				console.log(r);
			}
		</script>
